package com.sys.object.common.context;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

import org.springframework.util.StringUtils;

public class Config {
	public Config(){}
	/*private static Properties props_kindeditor = new Properties();
	private static Properties props_uploadify = new Properties();
	private static Properties props_down = new Properties();*/
	
	
	private static Properties props_config = new Properties();
	static{
		try {
			/*props_kindeditor.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("kindeditor.properties"));
			props_uploadify.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("uploadify.properties"));
			props_down.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("downfile.properties"));*/
			
			props_config.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("config.properties"));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
/*	public static String getKindeditorValue(String key){
		return props_kindeditor.getProperty(key);
	}

    public static void updateKindeditorProperties(String key,String value) {    
    	props_kindeditor.setProperty(key, value); 
    }
    
    public static String getUploadifyValue(String key){
		return props_uploadify.getProperty(key);
	}

    public static void updateUploadifyProperties(String key,String value) {    
    	props_uploadify.setProperty(key, value); 
    }
    
    public static String getDownValue(String key){
		return props_down.getProperty(key);
	}

    public static void updateDownProperties(String key,String value) {    
    	props_down.setProperty(key, value); 
    }*/
	public static Boolean getValueBoolean(String key){
		String str = props_config.getProperty(key);
		if(StringUtils.hasText(str))
			return Boolean.parseBoolean(str);
		return false;
	}
    
    public static String getConfigValue(String key){
		return props_config.getProperty(key);
	}

    public static void updateConfigProperties(String key,String value) {    
    	props_config.setProperty(key, value); 
    }
    
}
